package com.coolpad.MQ.kafka;

import kafka.serializer.Encoder;

import java.util.Properties;

/**
 * producer共同的接口.
 *
 * @param <K> partition key type
 * @param <V> message value type
 * Created by gaoyang on 2020/11/4.
 */
public interface ProducerBase<K, V> {
    void init(Properties config);
    com.coolpad.MQ.kafka.ProducerBase<K, V> setKeyEncoder(Encoder<K> keyEncoder);
    com.coolpad.MQ.kafka.ProducerBase<K, V> setContentEncoder(Encoder<V> contentEncoder);

    void start();

    boolean send(String topic, K key, V message);

    void close();

    String typeName();
}
